package com.lh.lepay.utils;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.util.regex.Pattern;

@Slf4j
@Component
public class AmountValid {

    private static final String AMOUNT_PATTERN = "^\\d+(\\.\\d{1,2})?$";

    public boolean isValidAmount(String amount) {
        if (amount == null || amount.isEmpty() || amount.matches(AMOUNT_PATTERN)) {
            return false; // 或者根据需求返回 true 并设置消息
        }
        return amount.matches(AMOUNT_PATTERN);
    }

}
